package app.controller.wechat;

import javax.servlet.http.HttpServletResponse;

import com.scyf.weixintool.WeiXinMessageResolver;


public interface EventHandle {

	default void Handle(HttpServletResponse response,String xml){
		String msgType = WeiXinMessageResolver.getMsgType(xml);
		try {
			if (WeiXinMessageResolver.IMAGE.equals(msgType)) {
				IMAGEResolver(response, xml);
			} else if (WeiXinMessageResolver.LINK.equals(msgType)) {
				LINKResolver(response, xml);
			} else if (WeiXinMessageResolver.LOCATION.equals(msgType)) {
				LOCATIONResolver(response, xml);
			} else if (WeiXinMessageResolver.SHORTVIDEO.equals(msgType)) {
				SHORTVIDEOResolver(response, xml);
			} else if (WeiXinMessageResolver.TEXT.equals(msgType)) {
				TEXTResolver(response, xml);
			} else if (WeiXinMessageResolver.VIDEO.equals(msgType)) {
				VIDEOResolver(response, xml);
			} else if (WeiXinMessageResolver.VOICE.equals(msgType)) {
				VOICEResolver(response, xml);
			} 
		} catch (Exception e) {
			// TODO: handle exception
			System.out.println("消息处理出错");
		}
	}
//	case WeiXinMessageResolver.TEXT:
	void TEXTResolver(HttpServletResponse response,String xml) throws Exception;
//	case WeiXinMessageResolver.IMAGE:
	void IMAGEResolver(HttpServletResponse response,String xml) throws Exception;
//	case WeiXinMessageResolver.VOICE:
	void VOICEResolver(HttpServletResponse response,String xml) throws Exception;
//	case WeiXinMessageResolver.VIDEO:
	void VIDEOResolver(HttpServletResponse response,String xml) throws Exception;
//	case WeiXinMessageResolver.SHORTVIDEO:
	void SHORTVIDEOResolver(HttpServletResponse response,String xml) throws Exception;
//	case WeiXinMessageResolver.LOCATION:
	void LOCATIONResolver(HttpServletResponse response,String xml) throws Exception;
//	case WeiXinMessageResolver.LINK:
	void LINKResolver(HttpServletResponse response,String xml) throws Exception;
	
	
}
